package com.lingyuting.wechat;


import java.util.List;

import com.lingyuting.wechat.models.Topic;
import com.lingyuting.wechat.util.WechatUtil;

public class WCSpider extends WechatUtil {

    /**
     * <pre>
     *  new WechatSpider("123").getPageDocs(1); 获取第一页的的全部文章
     * </pre>
     * 
     * @param id
     *            微信公共号的openId
     */
    public WCSpider(String id) {
        super.setId(id);
        //super.excute();
    }

    /**
     * 微信公众号抓取
     * 
     * 玩车教授   gzwcjs     ||   汽车点评     cardianping    ||   车买买      cmm445   ||   改车志    gaichezhi   ||    大家车言论  yypcar
     * 
     * 车澎湃   lywbqc    ||   车维修    wwwcheweixiu   ||   车域无疆    Walking_in_Auto_Life    || 豪华车视界   haohuacar   ||  智选车  SeleCar
     * 
     * 买车网    buycars   ||  小强汽车圈    auto_lab   ||    我为车狂    fjtv-wwck   ||     云堆汽车榜     yundui8   ||    买车顾问    carschina2
     * 
     * 快车报   kuaichebao  ||  汽车视界    yangchewu  ||   汽车圈子   qcquanzi  ||  联合越野   chnsuv    ||  汽车掌上之家    qczszj
     *
     * 阿川说车  wangchuan_acsc
     */
    public static void main(String[] args) {

    	
    	WCSpider spider = new WCSpider("chnsuv");
    	
        String listUrl = spider.getListUrl();
        System.out.println(listUrl);
        List<String> list = spider.getTopicUrls(listUrl);
        for (String url : list) {
        	System.out.println(url);
			Topic topic = spider.getTopicByUrl(url);
			System.out.println(topic.getTitle());
			System.out.println(topic.getContentHtml());
			System.err.println("##########################################################################################################");
			
		}
    }

}
